<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      border: 0;
    }

    #app {
      width: 200px;
      height: 400px;
      background: red;
      /* 触发BFC条件 */
      /* position: absolute; */
      /* overflow: hidden; */
      /* border: 1px solid; */
      /* overflow: auto; */
      /* float: left; */
      /* display: inline-block; */
      display: table;
      /* display: table-caption; */
      /* display: table-cell; */
    }

    #block {
      /* margin-left/top 都是以父元素width为参考 */
      margin-left: 50%;
      margin-top: 50%;
      width: 100px;
      height: 100px;
      background: green;
    }
  </style>
</head>

<body>
  <div id="app">
    <div id="block">

    </div>
  </div>
</body>

</html>